package com.uni.crawl.controller.crawl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.uni.crawl.common.result.PageResult;
import com.uni.crawl.model.query.crawl.CrawlInstancePageQuery;
import com.uni.crawl.model.vo.crawl.CrawlInstanceVO;
import com.uni.crawl.service.crawl.CrawlInstanceService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Tag(name = "爬虫实例管理接口")
@RestController
@RequestMapping("/api/v1/crawl/instance")
@RequiredArgsConstructor
public class CrawlInstanceController {

    private final CrawlInstanceService crawlInstanceService;

    @Operation(summary = "爬虫实例分页列表")
    @PostMapping("/page")
    public PageResult<CrawlInstanceVO> getDictPage(@RequestBody CrawlInstancePageQuery pageQuery) {
        Page<CrawlInstanceVO> result = crawlInstanceService.getPage(pageQuery);
        return PageResult.success(result);
    }
}
